/*******************************************************************************
*   Copyright (C) Harbin Institute of Technology, Shenzhen.
*				  All Rights Reserved.
*   Department: Decoration
********************************************************************************
* File Name   : ros_if.h
* Author      : Dayuan
* Version     : v0.01
* Date        : 2019/9/6
* Description : Decoration Rototics Manipulator task.
*******************************************************************************/
/*-History----------------------------------------------------------------------
* Version   Date      Name        Changes and comments
* v0.01     2019/9/6  Dayuan    initial version
*=============================================================================*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _ROS_IF_H_
#define _ROS_IF_H_

#ifdef __cplusplus
 extern "C" {
#endif
     
/**** Includes ****/
#include <stdint.h>
#include "algorithm_if.h"
#include "gb_if.h"

/**** Definition of constants ****/

/**** Definition of types ****/ 
typedef enum
{
	GB_SET = 0X00,
	GB_POSE,				//rx
	GB_ANGLED, 			//rx
	GB_KD_DESIRED		//rx
}ROS_CMD;

typedef enum
{
	GB_STOP = 0x00,
	GB_START,
	GB_PAUSE,
	GB_RESUME,
	GB_RESTART,
}MAIN_MODE;			//high 8-bits of data

typedef enum
{	
	GB_POSITION = 0x00,
	GB_IMPADENCE,
	GB_ZEROFORCE
}SUB_MODE;			//low 8-bits of data


typedef struct
{
	uint16_t head;
	uint8_t cmd;
	int16_t data;
	uint8_t crc;
	uint8_t buff[6];
	uint16_t crc_error;
}ROS_INFO;

typedef struct
{
	MAIN_MODE main_mode;
	SUB_MODE sub_mode;
}SYS_CMD;

/**** Definition of macros ****/

/**** Declaration of constants ****/

/**** Declaration of variables ****/
extern int parse_ros_info(SYS_CMD *sys, JOINT_INFO *joint);
extern void send_to_ros(ROS_INFO *ros_info, JOINT_INFO *joint);
extern void ros_rx_callback(void);
extern void ros_send_data(JOINT_INFO *joint);
extern void ros_initial(void);


/**** Declaration of functions ****/

#ifdef __cplusplus
}
#endif

#endif
